$(function () {
    var log_datagrid = $("#log_datagrid");

    log_datagrid.datagrid({
        fit:true,
        url:"/systemLog/list",
        fitColumns:true,
        pagination:true,
        rownumbers:true,
        striped:true,
        toolbar:"#tb",
        singleSelect:true,
        columns:[[
            {field:"ck",checkbox:true},  //显示多选框样式
            {field:"id", title:"编号", width:100 ,hidden:true},
            {field:"opuser", title:"操作者", width:100,formatter:function(value, row, index){
                if(value){
                    return value.username;
                }else{
                    return "[登录操作]";
                }
            }},
            {field:"optime", title:"操作时间", width:100,formatter: function (value,row) {
                return "<p>"+row.optime+"</p>"
            }},
            {field:"opip", title:"IP地址", width:100},
            {field:"function", title:"执行操作", width:100},
            {field:"params", title:"参数", width:100}
        ]]
    });

    var cmdObj = {
        //工具栏的刷新
        reload: function (){
            log_datagrid.datagrid("load");
        },
        //工具栏的高级查询
        query: function(){

            var kw = $("#keyword").textbox("getValue");
            var begin=$("#beginDate").datebox("getValue");
            var end=$("#endDate").datebox("getValue");
            log_datagrid.datagrid("load", {
                keyword:kw,
                beginDate:begin,
                endDate:end
            });
        }
    }//end
    //调用
    $("a[data-cmd]").click(function(){
        var cmd = $(this).data("cmd");
        cmdObj[cmd]();
    })
})


